import CryptoJS from 'crypto-js'
// const CryptoJS = require('crypto-js');

function sign(param, timestamp, appKey, secret, body) {
    let tempParams = appKey + timestamp
    if (JSON.stringify(param) !== "{}") {
        Object.keys(param).forEach((item, index) => {
            tempParams += item[index]
        })
    }
    tempParams += 'HmacSha1'
    return CryptoJS.enc.Base64.stringify(tempParams)
}

